require "Common/define"
require "Logic/Config"
require "Common/functions"
UIRankingSpeak = {};
HelperFunc.SetUIEnv(UIRankingSpeak)
local this = UIRankingSpeak;

function UIRankingSpeak.Init()
    local name, packageName = getUIName(PanelResNames.UIRankingSpeak);
    panelMgr:Push(name, packageName, this.onCreate, Config.useLocalUI);
end

function UIRankingSpeak.onCreate(obj)
    close=obj:GetChild("close");
    start=obj:GetChild("start");
    black=obj:GetChild("black");
    inputName=obj:GetChild("inputName");
    close.onClick:Add(this.onClose);
    start.onClick:Add(this.SendSpeak);
    black.onClick:Add(this.onClose);

end

function UIRankingSpeak.SendSpeak()
    local tex=inputName.text;
    if logicMgr.ChatManager.HasFilterBlockWord(tex) then
        UISysTips.AddMsg(getLanguage("UIFriend_ApplyMsgBlock"))
       else 
        NoticeHandler.ReqEditMsg(tex);
    end 
    this.onClose();
end

function UIRankingSpeak.onClose()
    closeUI(PanelResNames.UIRankingSpeak);
end

function UIRankingSpeak.OnDestroy()

end

function UIRankingSpeak.OnEnable()

end

function UIRankingSpeak.OnDisable()
    -- close.onClick:remove(this.onClose);
    -- start.onClick:remove(this.SendSpeak);
    -- black.onClick:remove(this.onClose);
end


return UIRankingSpeak;